package com.invite.me.ui.home.fragment;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.invite.me.R;
import com.invite.me.base.BaseFragment;
import com.invite.me.beans.adpater.BusinessAdpater;
import com.invite.me.beans.bilnddatabean.BlindDataBean;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.ArrayList;
import java.util.List;

public class ProgramFragment extends BaseFragment {

    private SmartRefreshLayout myxiangqinsmartrefresh;
    List<BlindDataBean> list=new ArrayList<>();
    private RecyclerView shangwu_recycler;
    BusinessAdpater businessAdpater;


    @Override
    protected void initView(View view) {
        shangwu_recycler = view.findViewById(R.id.xiangqin_recycler);
        myxiangqinsmartrefresh = view.findViewById(R.id.myxiangqinsmartrefresh);
        myxiangqinsmartrefresh.setEnableRefresh(false);//是否启用下拉刷新功能
        myxiangqinsmartrefresh.setEnableLoadMore(true);//是否启用上拉加载功能
        loadData();
        GridLayoutManager layoutManage = new GridLayoutManager(getActivity(), 2);
        shangwu_recycler.setLayoutManager(layoutManage);
        businessAdpater=new BusinessAdpater(R.layout.business_list,list);
        shangwu_recycler.setAdapter(businessAdpater);
        businessAdpater.notifyDataSetChanged();
    }

    @Override
    protected void loadData() {
        for (int i=0;i<30;i++){
            list.add(new BlindDataBean("小美矿囧了反萨开机放量阿空降幅凯撒"+i,"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3852329400,3428852864&fm=26&gp=0.jpg","200"));

        }
    }

    @Override
    protected int getFrgamentLayoutId() {
        return R.layout.fragment_program;
    }
}
